<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <zxxjjforever@163.com>
// +----------------------------------------------------------------------
namespace app\blog\controller;

use app\admin\model\UserModel;
use app\blog\model\BusinessModel;
use app\blog\model\StoreModel;
use App\Http\Model\Home\goods;
use cmf\controller\AdminBaseController;
use think\Db;
class ShopdetailController extends AdminBaseController
{
    public function index(){
       $shop=DB::name('store')->select();
        $this->assign('shop',$shop);

        return $this->fetch();
    }

    public function del(){
        //删除店铺
        $param = $this->request->param();
        $param=$param['id'];
        //var_dump($param);exit;
        DB::name('store')->where('id',$param)->delete();

        echo "<script>alert('删除成功')</script>";
        return redirect('store/add');
    }

    function status(){
        $param = $this->request->param();
        $param=$param['id'];
        //var_dump($param);exit;
       $status=DB::name('store')->where('id',$param)->field('status')->find();
        //$jtime=DB::name('store')->where('id',$param)->field('jtime')->find();
        //var_dump($jtime);exit;
        $status=join('',$status);
        //var_dump($status);exit;
        if($status=='0'){
            $data['status']=1;

           $usre= new StoreModel();
           //$uu->where('id',$id)->setField($data);
            $usre->where('id',$param)->setField($data);
            $this->success('成功');

        }elseif($status=='1'){
            $data['status']=0;
            $data['jtime']=time();
            $usre= new StoreModel();
            $usre->where('id',$param)->setField($data);
            $this->success('成功');
        }
    }








}
























